<?php
##
define('PRO','1');
define('SCR','login');
require_once('global.php');
require_once(R_P . 'require/checkpass.php');


$debug=$_GET['debug'];
$pwuser= $_GET['username'] ;//"chenxdclear";
//$pwpwd="nwm9Gy";
$md5Pwd = $_GET['pwdmd5'];//"86170be9ef0b6a08feb288195cfb67ae";
//md5($pwpwd);
$loginInfo = checkpass($pwuser, $md5Pwd, '', $lgt, false);

if ($debug == true)
{	echo "pwd md5 is " . $md5Pwd . "<br>";
	echo "login result:" . $loginInfo[0]."<br>";
}
//login_errortype		0x01
//user_not_exists		0x02
//reg_email_have_same	0x03
//login_forbid		0x04
//login_jihuo		0x05
//login_pwd_error		0x06
$retval=0;
$errinfo="";

if (   gettype($loginInfo) == "array"  )
{
		echo "retval=0;";
}

else
{
	$errinfo  = $loginInfo ;
		
	switch($errinfo)
	{
		case "login_errortype":
			$retval = 0x01;
			break;
			
		case "user_not_exists":
			$retval = 0x02;
			break;
			
		case "reg_email_have_same":
			$retval = 0x03;
			break;
			
		case "login_forbid":
			$retval = 0x04;
			break;
			
		case "login_jihuo":
			$retval = 0x05;
			break;
			
		case "login_pwd_error":
			$retval = 0x06;
			break;
			
		case "login_usernamepwd_error":
			$retval = 0x07;
			break;
			
		default:
			$retval= 0x0ff;
			break;
		
	}
	echo "retval=" . $retval .";" .$errinfo.";";
}


?>
